package com.design02_Structural.pattern06_proxy.proxy03;

import java.util.List;

/**
 * @ClassName Client
 * @Description TODO
 * @Author zhangjunhao
 * @DATE 2023/9/4 20:20
 */
public class Client {

    public static void main(String[] args) {

        //目标对象
        UserServiceImpl userService = new UserServiceImpl();
        System.out.println(userService.getClass());


        //代理对象
        UserServiceImpl proxy = (UserServiceImpl) new
                UserLogProxy(userService).getLogProxy();
        System.out.println(proxy.getClass());
        List<User> userList = proxy.findUserList();
        System.out.println("用户信息: "+userList);


        //class com.Structural.proxy01.proxy03.UserServiceImpl
        //class com.Structural.proxy01.proxy03.UserServiceImpl$$EnhancerByCGLIB$$30619a1
        //2023-09-04 20:23:25 [findUserList] 查询用户信息...]
        //用户信息: [User{name='tom', age=18}]

    }
}
